import request from '@/utils/request'

const api_name = '/acl/user'

export default {

    getPageList(pageQuery) {
        return request({
            url: `${api_name}/getUserPage`,
            method: 'post',
            data: pageQuery // url查询字符串或表单键值对
        })
    },
    getById(id) {
        return request({
          url: `${api_name}/getUserById?id=${id}`,
          method: 'get'
        })
      },
    
      save(user) {
        return request({
          url: `${api_name}/save`,
          method: 'post',
          data: user
        })
      },
    
      updateById(user) {
        return request({
          url: `${api_name}/update`,
          method: 'put',
          data: user
        })
      },
      getAssign(userId){
        return request({
          url: `${api_name}/getRolesByUserId?userid=${userId}`,
          method: 'get'
        })
      },
      saveAssign(userid, roles){
        return request({
          url: `${api_name}/saveUserRoles`,
          method: 'post',
          params:{userid, roles}
        })
      },
      removeById(id){
        return request({
          url: `${api_name}/remove?id=${id}`,
          method: 'delete'
        })
      },
      removeRows(idList){
        return request({
          url: `${api_name}/batchRemove`,
          method: 'delete',
          data:idList
        })
      }
}
